module PriceProtect
  class << self
    # attr_accessor :configuration

    def config
      # self.configuration ||= Configuration.new
      return @config if defined?(@config)
      @config = Configuration.new
    end

    def configure(&block)
      config.instance_exec(&block)
    end
  end

  class Configuration
    attr_accessor :security_level, :image_store_path, :storeage
    attr_accessor :upyun_bucket, :upyun_username, :upyun_password, :upyun_host

    def initialize
      @security_level = 5
      @image_store_path = '/tmp/price-project-images'
      # 存储方式
      # @storeage = :local
      @storeage = :upyun
      @upyun_bucket = "price-protect"
      @upyun_username = "huangzh"
      @upyun_password = "84869073asd"
      @upyun_host = "http://price-protect.b0.upaiyun.com"
    end

    def is_upyun_storeage?
      storeage == :upyun
    end
  end
end